Scroll to navigation

guestfs-gobject(3) Virtualization Support guestfs-gobject(3)

NAME

guestfs-gobject - How to use libguestfs with the GObject bindings

SYNOPSIS

From Javascript using gjs:

 const Guestfs = imports.gi.Guestfs;
 var g = new Guestfs.Session();
 g.add_drive('disk.img', null);
 g.launch();
 g.close();

DESCRIPTION

This manual page documents how to call libguestfs using GObject bindings, especially from Javascript.

Note that the GObject bindings have problems handling 64 bit values. You should not use the GObject bindings if there are native bindings for your language. For example, to use libguestfs from Python you are strongly advised to use the Python native bindings instead (see guestfs-python(3)).

This page just documents the differences from the C API and gives some examples. If you are not familiar with using libguestfs, you also need to read guestfs(3).

JAVASCRIPT

Using gjs, you can write a ".js" file containing:

 const Guestfs = imports.gi.Guestfs;
 var g = new Guestfs.Session();
 g.add_drive('disk.img', null);
 g.launch();
 g.close();

and then run it using:

 gjs program.js

SEE ALSO

guestfs(3), guestfs-examples(3), guestfs-erlang(3), guestfs-golang(3), guestfs-java(3), guestfs-lua(3), guestfs-perl(3), guestfs-python(3), guestfs-recipes(1), guestfs-ruby(3), http://libguestfs.org/.

AUTHORS

Richard W.M. Jones ("rjones at redhat dot com")

COPYRIGHT

Copyright (C) 2012-2023 Red Hat Inc.

LICENSE

This manual page contains examples which we hope you will use in your programs. The examples may be freely copied, modified and distributed for any purpose without any restrictions.

BUGS

To get a list of bugs against libguestfs, use this link: https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools

To report a new bug against libguestfs, use this link: https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools

When reporting a bug, please supply:

  • The version of libguestfs.
  • Where you got libguestfs (eg. which Linux distro, compiled from source, etc)
  • Describe the bug accurately and give a way to reproduce it.
  • Run libguestfs-test-tool(1) and paste the complete, unedited output into the bug report.
2023-02-21 libguestfs-1.50.1